local wen__yuanmou = fk.CreateSkill {
  name = "wen__yuanmou",
}

Fk:loadTranslationTable{
  ["wen__yuanmou"] = "远谋", 
  [":wen__yuanmou"] = "准备阶段，你可以选择一项：1.观看一名其他角色的手牌；2.移动你场上的一张牌。若如此做，本回合你的手牌上限+1。", 
  ["#wen__yuanmou"] = "远谋：选择一名其他角色",
  ["wen__yuanmou_viewhand"] = "观看其手牌",
  ["wen__yuanmou_movecard"] = "移动你场上的一张牌",
}

wen__yuanmou:addEffect(fk.EventPhaseStart, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player
      and player:hasSkill(wen__yuanmou.name)
      and player.phase == Player.Start
  end,

  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to = room:askToChoosePlayers(player, {
      min_num = 1,
      max_num = 1,
      targets = room:getOtherPlayers(player, false),
      skill_name = wen__yuanmou.name,
      prompt = "#wen__yuanmou",
      cancelable = true,
    })
    if #to > 0 then
      event:setCostData(self, {tos = to})
      return true
    end
  end,

  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    local choices = {"wen__yuanmou_viewhand", "wen__yuanmou_movecard" }
    local choice = room:askToChoice(player, {
      choices = choices,
      skill_name = wen__yuanmou.name,
    })
    if choice:startsWith("wen__yuanmou_viewhand") then
      room:viewCards(player, {
        cards = to:getCardIds("h"),
        skill_name = wen__yuanmou.name,
      })
    else
      room:askToMoveCardInBoard(player, { target_one = player, target_two = to, skill_name = wen__yuanmou.name })
    end
  end,
})

wen__yuanmou:addEffect("maxcards", {
  correct_func = function(self, player)
      return player:usedSkillTimes(wen__yuanmou.name, Player.HistoryTurn)
  end,
})

return wen__yuanmou